<template>
	<view>
		<view class="main">
			<view :class="num==1?'select':'noselect'" @click="change(1)">
				关注
			</view>
			<view :class="num==2?'select2':'noselect2'" @click="change(2)">
				最新
			</view>

			<view class="kuang" v-if="num==1">
				<view class="tan" v-for="(item,index) in menu" @click="jump">
					<image class="image1" src="../../static/users/lun2.png" mode="aspectFill"></image>
					<view class="title">
						天气真好 秋季到来落叶枯黄。
					</view>
					<image class="image2" src="../../static/users/hearer.png" mode="aspectFill"></image>
					<view class="name">
						山海未眠
					</view>
					<image @click.stop="menu[index].show=true" v-if="!item.show" class="image3"
						src="../../static/users/zan.png" mode="aspectFill"></image>
					<image @click.stop="item.show=false" v-if="item.show" class="image3" src="../../static/users/zanguo.png"
						mode="aspectFill"></image>

					<view class="num_zan">
						6
					</view>
				</view>
			</view>

			<view class="kuang" v-if="num==2">
				<view class="tan" v-for="(item,index) in list" @click="jump">
					<image class="image1" src="../../static/users/lun3.png" mode="aspectFill"></image>
					<view class="title">
						天气真好 秋季到来落叶枯黄。
					</view>
					<image class="image2" src="../../static/users/hearer.png" mode="aspectFill"></image>
					<view class="name">
						山海未眠
					</view>
					<image @click.stop="list[index].shower=true" v-if="!item.shower" class="image3"
						src="../../static/users/zan.png" mode="aspectFill"></image>
					<image @click.stop="item.shower=false" v-if="item.shower" class="image3"
						src="../../static/users/zanguo.png" mode="aspectFill"></image>

					<view class="num_zan">
						6
					</view>
				</view>
			</view>
			<view class="bottom"></view>
		</view>

		<view class="release" @click="chan">
			发帖
		</view>
		
		<view class="msg" @click="msg">
			<view class="tips"></view>
			消息
		</view>
		


	</view>
</template>

<script>
	export default {
		data() {
			return {
				num: 1,
				menu: [],
				list: []
			}
		},
		methods: {
			change(index) {
				this.num = index
			},
			chan(){
               uni.navigateTo({
               	url:"../Post/Post"
               })
			},
			msg(){
				uni.navigateTo({
					url:"../message/message"
				})
			},
			jump(){
				uni.navigateTo({
					url:"../Postdetails/Postdetails"
				})
			}
		},
		onLoad() {
			for (var i = 0; i < 10; i++) {
				this.menu.push({
					show: false
				})
			}

			for (var j = 0; j < 10; j++) {
				this.list.push({
					shower: false
				})
			}
			console.log(this.list);
		}
	}
</script>

<style lang="scss">
	page {
		background: #F2F4FA;
	}

	.main {
		width: 750rpx;
		height: 1435rpx;
		background: #FFFFFF;
		border-radius: 40rpx;
		position: relative;
		position: absolute;

		.noselect {
			position: absolute;
			left: 40rpx;
			top: 30rpx;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: #333333;
		}

		.select {
			position: absolute;
			left: 40rpx;
			top: 30rpx;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 600;
			color: #181818;
		}

		.noselect2 {
			position: absolute;
			top: 30rpx;
			left: 142rpx;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: #333333;
		}

		.select2 {
			position: absolute;
			top: 30rpx;
			left: 142rpx;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 600;
			color: #181818;
		}

		.kuang {
			margin: 86rpx 0 0 0rpx;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-evenly;

			.tan {

				width: 334rpx;
				height: 620rpx;
				position: relative;

				.image1 {
					width: 334rpx;
					height: 460rpx;

				}

				.title {
					margin: 20rpx 0 0 11rpx;
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #181818;
					line-height: 36rpx;
				}

				.image2 {
					margin: 19rpx 0 0 9rpx;
					width: 45rpx;
					height: 45rpx;
				}

				.name {
					position: absolute;
					bottom: 45rpx;
					left: 70rpx;
					font-size: 20rpx;
					font-family: PingFang SC;
					font-weight: 300;
					color: #666666;
				}

				.image3 {
					position: absolute;
					bottom: 46rpx;
					left: 276rpx;
					width: 36rpx;
					height: 30rpx;
				}

				.num_zan {
					position: absolute;
					right: 4rpx;
					bottom: 46rpx;
					font-size: 20rpx;
					font-family: PingFang SC;
					font-weight: 300;
				}
			}
		}

		.bottom {
			width: 750rpx;
			height: 200rpx;
		}


	}

	.release {
		position: fixed;
		right: 10rpx;
		bottom: 395rpx;
		width: 90rpx;
		height: 90rpx;
		background: #F48F5B;
		border-radius: 50%;
		text-align: center;
		line-height: 90rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
	}
	
	.msg{
		position: fixed;
		right: 10rpx;
		bottom: 274rpx;
		width: 90rpx;
		height: 90rpx;
		background: #181818;
		border-radius: 50%;
		text-align: center;
		line-height: 90rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		.tips{
			position: absolute;
			right: 0;
			top: 8rpx;
			width: 18rpx;
			height: 18rpx;
			background: #FF5656;
			border-radius: 50%;
		}
	}
</style>
